﻿<%@ Page Title="Change Password" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ChangePassword.aspx.cs" Inherits="Account_ChangePassword" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Change Password
    </h2>
    <p>
        Use the form below to change your password.
    </p>
    <p>
        New passwords are required to be a minimum of <%= Membership.MinRequiredPasswordLength %> characters in length.
    </p>
    <div>
        <span class="failureNotification">
            <asp:Literal ID="FailureText" runat="server"></asp:Literal>
        </span>

        <div class="accountInfo">
            <fieldset class="changePassword">
                <legend>Account Information</legend>
                
                <asp:ValidationSummary ID="ChangeUserPasswordValidationSummary" runat="server" CssClass="failureNotification" ValidationGroup="ChangeUserPasswordValidationGroup"/>
                <div class="success" ID="changePasswordMessage" runat="server" visible="false"></div>
                
                <div class="control-group">
                    <asp:Label ID="CurrentPasswordLabel" runat="server" CssClass="control-label" AssociatedControlID="CurrentPassword">Old Password:</asp:Label>
                    <div class="controls">
                        <asp:TextBox ID="CurrentPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="CurrentPasswordRequired" runat="server" ControlToValidate="CurrentPassword" 
                                CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Old Password is required." 
                                ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:RequiredFieldValidator>
                        <asp:CustomValidator id="ValidCurrentPasswordValidator" runat="server" 
                          OnServerValidate="ValidCurrentPasswordValidator_Validate" 
                          ControlToValidate="CurrentPassword" 
                          ValidationGroup="ChangeUserPasswordValidationGroup" 
                          ForeColor="Red"
                          ErrorMessage="The current password supplied is incorrect">
                        </asp:CustomValidator>
                    </div>
                </div>

                <div class="control-group">
                    <asp:Label ID="NewPasswordLabel" runat="server" CssClass="control-label" AssociatedControlID="NewPassword">New Password:</asp:Label>
                    <div class="controls">
                        <asp:TextBox ID="NewPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="NewPasswordRequired" runat="server" ControlToValidate="NewPassword" 
                                CssClass="failureNotification" ErrorMessage="New Password is required." ToolTip="New Password is required." 
                                ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:RequiredFieldValidator>
                    </div>
                </div>
                <div class="control-group">
                    <asp:Label ID="ConfirmNewPasswordLabel" runat="server" CssClass="control-label" AssociatedControlID="ConfirmNewPassword">Confirm New Password:</asp:Label>
                    <div class="controls">
                        <asp:TextBox ID="ConfirmNewPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="ConfirmNewPasswordRequired" runat="server" ControlToValidate="ConfirmNewPassword" 
                                CssClass="failureNotification" Display="Dynamic" ErrorMessage="Confirm New Password is required."
                                ToolTip="Confirm New Password is required." ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:RequiredFieldValidator>
                        <asp:CompareValidator ID="NewPasswordCompare" runat="server" ControlToCompare="NewPassword" ControlToValidate="ConfirmNewPassword" 
                                CssClass="failureNotification" Display="Dynamic" ErrorMessage="The Confirm New Password must match the New Password entry."
                                ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:CompareValidator>
                    </div>
                </div>

                <div class="control-group">
                    <asp:Button ID="ChangePasswordPushButton" CssClass="btn btn-primary" 
                        CausesValidation="true"
                        runat="server" CommandName="ChangePassword" Text="Change Password" 
                        ValidationGroup="ChangeUserPasswordValidationGroup" 
                        onclick="ChangePasswordPushButton_Click"/>
                </div>
            </fieldset>
        </div>
    </div>
</asp:Content>